﻿using NPOI.SS.UserModel;
using System;

namespace Soul.Excel
{
    public class ExcelMergeRegion
    {
        public object Value { get; set; }
        public int FirstRow { get; set; }
        public int LastRow { get; set; }
        public int FirstColumn { get; set; }
        public int LastColumn { get; set; }

        internal Action<ExcelStyle> _styleConfigure;

        public ExcelMergeRegion(int firstRow, int lastRow, int firstColumn, int lastColumn)
        {
            FirstRow = firstRow;
            LastRow = lastRow;
            FirstColumn = firstColumn;
            LastColumn = lastColumn;
        }

        public ExcelMergeRegion(object value, int firstRow, int lastRow, int firstColumn, int lastColumn, Action<ExcelStyle> style)
        {
            Value = value;
            FirstRow = firstRow;
            LastRow = lastRow;
            FirstColumn = firstColumn;
            LastColumn = lastColumn;
            _styleConfigure = style;
        }

        public void ApplyStyle(ICellStyle style)
        {
            _styleConfigure?.Invoke(new ExcelStyle(style));
        }
    }
}
